package com.sxt.consumer;

import com.rabbitmq.client.Channel;
import com.sxt.domain.User;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 雷哥
 * @Date: 2020/10/07/22:24
 * @Description:
 */
@Component
public class HelloConsumer {

//  @RabbitHandler
  @RabbitListener(queuesToDeclare = {@Queue("hello")})
//  public void receive(String body){
  public void receive(User user, Message message, Channel channel){
    System.out.println("消费者收到消息：内容为:"+user);
    System.out.println(message);
    System.out.println(channel);
  }

}
